package com.nstar.orderexpress.view
{
	import mx.events.FlexEvent;
	import flash.events.MouseEvent;
	import com.adobe.cairngorm.control.CairngormEventDispatcher;
	import com.nstar.orderexpress.control.QueryEvent;
	import com.nstar.orderexpress.vo.QueryVO;
	import mx.controls.Image;
	import com.nstar.orderexpress.model.Model;
	import com.nstar.base.util.Logger;
	import mx.controls.Button;
	import com.nstar.orderexpress.control.PingEvent;
	import mx.containers.VBox;

	public class WelcomeClass extends VBox
	{
		public var imgMap:Image ;
		public var btnPing:Button;
		
		private var model:Model = Model.getInstance();
		private var logger:Logger = Logger.getInstance();
		
		public function WelcomeClass()
		{
			//TODO: implement function
			super();
			this.addEventListener(FlexEvent.CREATION_COMPLETE,init);
		}
		
		private function init(event:FlexEvent):void{
			imgMap.addEventListener(MouseEvent.DOUBLE_CLICK,dblHandler);
			btnPing.addEventListener(MouseEvent.CLICK,pingHandler);
		}
		
		//双击地图进入下一步
		private function dblHandler(event:MouseEvent):void{
			model.mainApp.vsMain.selectedIndex = 1;
		}
		
		//ping数据库
		private function pingHandler(event:MouseEvent):void{
			var pingEvent:PingEvent = new PingEvent("select * from user_info");
			CairngormEventDispatcher.getInstance().dispatchEvent(pingEvent);
		}
		
	}
}